// 发布订阅模式的设计
import url from './function/url'
import { removeEmpty } from './function/removeEmpty'
import base64 from './function/base64'
import throttle from './function/throttle'
import debounce from './function/debounce'
import timeFormat from './function/timeFormat'
import timeFrom from './function/timeFrom'
import guid from './function/guid'
import deepClone from './function/deepClone'
import deepMerge from './function/deepMerge'
import file from './function/file'
import test from './function/test'
import table from './function/table'
import sse from './function/sse'
import { params } from './function/params'
import { treeToArray, arrayToTree } from './function/treeUtil'
import showNotification from './function/notification'
const $lizhao = {
	url,
	base64,
	treeToArray,
	arrayToTree,
	throttle,
	debounce,
	timeFormat,
	timeFrom,
	guid,
	deepClone,
	deepMerge,
	file,
	test,
	params,
	table,
	sse,
	removeEmpty,
	showNotification
}

// 全局组件
import DownloadExcel from './components/DownloadExcel/DownloadExcel.vue'
import LzTableColumn from './components/LzTableColumn/LzTableColumn.vue'

const globalComponents = { DownloadExcel, LzTableColumn }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const install = (app : any, options ?: any) => {
	// console.log(app, options)
	// 全局挂载方法 不推荐 在原型链上挂载一些东西这种方式，而是更建议使用 provide 和 inject 方式
	// app.config.globalProperties['$lizhao'] = $lizhao     //使用方法const { proxy } = getCurrentInstance() as ComponentInternalInstance
	// 注入全局方法
	app.provide('$lizhao', $lizhao) // 使用方法 let $lizhao = inject('$lizhao')
	// 全局组件
	Object.keys(globalComponents).forEach(key => {
		app.component(key, globalComponents[key as keyof typeof globalComponents])
	})
}

export default {
	install
}